package csci5828.tasks;

import java.util.concurrent.atomic.AtomicLong;

public class RequestId {
	private static AtomicLong counter = new AtomicLong();
	private long id;
	

	public RequestId() {
		super();
		this.id = counter.incrementAndGet();
	}
	
	public RequestId(long requestId) {
		this.id = requestId;
	}

	public long getId() {
		return id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RequestId other = (RequestId) obj;
		if (id != other.id)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "RequestId [id=" + id + "]";
	}

}
